package com.inspur_video.inspur_video.service;

import com.inspur_video.inspur_video.bean.User;
import com.inspur_video.inspur_video.dao.UserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Autowired
    private UserDao userDao;

    /**
     * 用户添加或更改
     * @param user
     * @return
     */
    public User userAdd(User user){
       return userDao.save(user);
    }

    /**
     * 用户名查找
     * @param username
     * @return
     */
    public User findOneByUserName(String username){
        return userDao.findUserByUName(username);
    }

    /**
     * 按照手机号查找
     * @param uPhoneNumber
     * @return
     */
    public User findOneByPhoneNumber(String uPhoneNumber){
        return userDao.findUserByUPhoneNumber(uPhoneNumber);
    }

    /**
     * 根据用户id查询
     * @param id
     * @return
     */
    public User findOneById(int  id){
        return userDao.findUserByUId(id);
    }

}
